<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */

require 'wp-blog-header.php';
require 'youku.php';
?>


	<?php include 'wp-content/themes/zhuli/header.php';
	 ?>
	
	<?php while ( have_posts() ) : the_post(); ?>
	<?php
		$page_id = $_GET["g"]; 
		if ($_GET["p"] == '')
			$page_number = 1;
		else
			$page_number = intval($_GET["p"]);

		if ($page_id == "")
			$page_id = 'vision';
	?>

	<title><?php echo get_the_title(); ?></title>

	<?php 
		$photo_tags = array('vision', 'customer', 'photo', 'mv', 'record');
		if (has_tag($photo_tags)) { ?>
			<link rel="stylesheet" type='text/css' href="<?php bloginfo('template_url'); ?>/css/zhuli-gallery.css">
			<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/zhuli-gallery.js"></script>
	<?php } else { ?>	
			<link rel="stylesheet" type='text/css' href="<?php bloginfo('template_url'); ?>/css/zhuli-article.css">
			<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/zhuli-article.js"></script>
	<?php }	?>
</head>
<body>
	<?php include 'wp-content/themes/zhuli/fixed-nav.php'; ?>

	
	<div id="p-container">		
	<?php if (has_tag($photo_tags)) { ?>		
		<?php include 'sidebar.php'; ?>
		<div id='p-gallery-content' class='single-view'>	
			<h1><?php 
					$title = get_the_title();
					$segs = explode( "-", $title ); 

				?>
				<div class='title'><?php echo $segs[1]; ?></div>
				<div class='title'><?php echo $segs[0]; ?></div>
			</h1>
			<div class='date'><?php the_date(); ?></div>
			<div class='p-gallery-photos'>

				<!--<?php if ($page_id!=='record' && $page_id!=='mv') the_post_thumbnail(); ?>-->
				<?php the_content(); ?>



		</div><!-- #content -->	
	<?php } else { ?>	
		<div class='p-article' style='border:none;'>
            <div class='date'>
            	<?php 
            		$date = get_the_date(); 
            		$segs = explode( ', ', $date );
        		?>
        		<div class='month-date'><?php echo $segs[0]; ?></div>
        		<div class='year'><?php echo $segs[1]; ?></div>
        	</div>
        	<div>
	            <h2><?php the_title(); ?></h2>
	            <p class='content'><?php echo get_the_content() ?></p>
	        </div>
        </div>
	<?php } ?> 
	</div><!-- #primary -->
<!-- 
	<div id='share-settings'>
		<div id='share-weibo'>
			<img src='<?php bloginfo('template_url'); ?>/img/share-weibo.png'>
			
			<script type="text/javascript" charset="utf-8">
			(function(){
			  var _w = 32 , _h = 32;
			  var param = {
			    url:location.href,
			    type:'1',
			    count:'', /**是否显示分享数，1显示(可选)*/
			    appkey:'', /**您申请的应用appkey,显示分享来源(可选)*/
			    title:'', /**分享的文字内容(可选，默认为所在页面的title)*/
			    pic:'', /**分享图片的路径(可选)*/
			    ralateUid:'', /**关联用户的UID，分享微博会@该用户(可选)*/
			    language:'zh_cn', /**设置语言，zh_cn|zh_tw(可选)*/
			    dpc:1
			  }
			  var temp = [];
			  for( var p in param ){
			    temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
			  }
			  document.write('<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://service.weibo.com/staticjs/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'"></iframe>')
			})()
			</script>
			<div>新浪微博</div>
		</div>
		<div id='share-tencent'>
			<img src='<?php bloginfo('template_url'); ?>/img/share-tencent.png'>
			<div>腾讯微博</div>
			<div id="qqwb_share__" data-appkey="801389953" data-icon="1" data-counter="0" data-content="{title}" data-richcontent="{line1}|{line2}|{line3}" data-pic="{pic}"></div>
			<script src="http://mat1.gtimg.com/app/openjs/openjs.js#autoboot=no&debug=no"></script>
		</div>
		<div id='share-renren'>
			<img src='<?php bloginfo('template_url'); ?>/img/share-renren.png'>
			<a name="xn_share" type="button" href="#">分享到人人</a><script src="http://static.connect.renren.com/js/share.js" type="text/javascript"></script>
			<div>人人网</div>
		</div>
		<div id='share-qzone'>
			<img src='<?php bloginfo('template_url'); ?>/img/share-qzone.png'>
			<script type="text/javascript">
			(function(){
			var p = {
			url:location.href,
			showcount:'0',/*是否显示分享总数,显示：'1'，不显示：'0' */
			desc:'',/*默认分享理由(可选)*/
			summary:'',/*分享摘要(可选)*/
			title:'',/*分享标题(可选)*/
			site:'',/*分享来源 如：腾讯网(可选)*/
			pics:'', /*分享图片的路径(可选)*/
			style:'201',
			width:39,
			height:39
			};
			var s = [];
			for(var i in p){
			s.push(i + '=' + encodeURIComponent(p[i]||''));
			}
			document.write(['<a version="1.0" class="qzOpenerDiv" href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?',s.join('&'),'" target="_blank">分享</a>'].join(''));
			})();
			</script>
			<script src="http://qzonestyle.gtimg.cn/qzone/app/qzlike/qzopensl.js#jsdate=20111201" charset="utf-8"></script>
			<div>QQ空间</div>
		</div>
	</div> -->
	<div id='back-to-top'>
		<a href='#'><img src='<?php bloginfo('template_url'); ?>/img/back-to-top.png'></a>
	</div>
	<?php include 'wp-content/themes/zhuli/service-footer.php'; ?>
</body>
	<?php endwhile; // end of the loop. ?>